package com.gateway.common.dto.route;


import java.util.Map;

/**
 * @program: ahcloud-gateway
 * @description:
 * @author: YuKai Fan
 * @create: 2023/2/21 23:20
 **/
public class FilterData {

    /**
     * 过滤器名称
     *
     * 路由id+过滤器名称，确定当前路由的过滤器
     */
    private String name;

    /**
     * 路由id
     */
    private String routeId;

    /**
     * 过滤器id
     */
    private String filterId;

    /**
     * 参数
     */
    private Map<String, String> args;

    /**
     * 处理器
     */
    private String handle;


    /**
     * rpcType
     */
    private String rpcType;


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Map<String, String> getArgs() {
        return args;
    }

    public void setArgs(Map<String, String> args) {
        this.args = args;
    }

    public String getHandle() {
        return handle;
    }

    public void setHandle(String handle) {
        this.handle = handle;
    }

    public String getRouteId() {
        return routeId;
    }

    public void setRouteId(String routeId) {
        this.routeId = routeId;
    }

    public String getFilterId() {
        return filterId;
    }

    public void setFilterId(String filterId) {
        this.filterId = filterId;
    }

    public String getRpcType() {
        return rpcType;
    }

    public void setRpcType(String rpcType) {
        this.rpcType = rpcType;
    }


    public static final class Builder {
        private String name;
        private String routeId;
        private String filterId;
        private Map<String, String> args;
        private String handle;
        private String rpcType;

        private Builder() {
        }

        public static Builder builder() {
            return new Builder();
        }

        public Builder name(String name) {
            this.name = name;
            return this;
        }

        public Builder routeId(String routeId) {
            this.routeId = routeId;
            return this;
        }

        public Builder filterId(String filterId) {
            this.filterId = filterId;
            return this;
        }

        public Builder args(Map<String, String> args) {
            this.args = args;
            return this;
        }

        public Builder handle(String handle) {
            this.handle = handle;
            return this;
        }

        public Builder rpcType(String rpcType) {
            this.rpcType = rpcType;
            return this;
        }

        public FilterData build() {
            FilterData filterData = new FilterData();
            filterData.setName(name);
            filterData.setRouteId(routeId);
            filterData.setFilterId(filterId);
            filterData.setArgs(args);
            filterData.setHandle(handle);
            filterData.setRpcType(rpcType);
            return filterData;
        }
    }
}
